﻿/*
 * Copyright © 2020, Wuxi Safover Intelligent Technology Co., Ltd. All rights reserved.
 * 
 * 无锡安永智能科技有限公司版权所有，未经许可，不得用于商业用途
 * 
 * Visit: https://www.safover.com/ 
 */

using System;
using System.Diagnostics;

namespace Safover.LidarCollector.Core
{
    internal class RotaryTableClosedStateController : BaseRotaryTableController
    {
        public override RotaryTableStatus RotaryTableStatus => RotaryTableStatus.Closed;

        public override bool CanOpen => true;

        public RotaryTableClosedStateController(RotaryTableDevice device) : base(device)
        { }

        public override bool TryOpen()
        {
            try
            {
                Device.KeepOpenSerialPort();
                SetStatus(RotaryTableStatus.Opened);
                return true;
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }

            return false;
        }
    }
}
